package com.gdepri.cabelwellserver.entity;

import lombok.Data;

import java.util.Arrays;

@Data
public class CabelMessage {

    private byte startWord=-23;//第一部分,起始字
    private int length;//第二部分，长度，2字节
    private int dataLength;//数据的长度为length-3,3包括了控制字和字节

    //第三部分控制字
    private String direction;
    private int packNum;
    private int funcCode;

    private int address;//第四部分 地址
    private byte[] data;//第五部分 数据
    private byte checkCode;//第六部分,校验字
    private byte endWord=-98;//第七部分,结束字

    @Override
    public String toString() {
        return "CabelMessage{" +'\n'+
                ", startWord=" + startWord + '\n'+
                ", length=" + length +'\n'+
                ", dataLength=" + dataLength +'\n'+
                ", direction='" + direction + '\'' +'\n'+
                ", packNum=" + packNum +'\n'+
                ", funcCode=" + funcCode +'\n'+
                ", address=" + address +'\n'+
                ", data=" + Arrays.toString(data) +'\n'+
                ", checkCode=" + checkCode +'\n'+
                ", endWord=" + endWord +'\n'+
                '}';
    }
}
